home *** CD-ROM | disk | FTP | other *** search
- #ifdef __STDC__
- static char sccs_id[] = "@(#) math.c 1.0 "__DATE__" HJR";
- #else
- static char sccs_id[] = "@(#) math.c 1.0 26/9/90 HJR";
- #endif
-
- /* math.c (c) Copyright 1990 H.Rogers */
-
- #include <math.h>
-
- #ifdef __STDC__
- double cosh(register double x)
- #else
- double cosh(x)
- register double x;
- #endif
- {
- return((exp(x) + exp(-x))/2);
- }
-
- #ifdef __STDC__
- double sinh(register double x)
- #else
- double sinh(x)
- register double x;
- #endif
- {
- return((exp(x) - exp(-x))/2);
- }
-
- #ifdef __STDC__
- double tanh(register double x)
- #else
- double tanh(x)
- register double x;
- #endif
- {
- register double x1,x2;
-
- x1 = exp(x); x2 = exp(-x);
- return((x1 - x2)/(x1 + x2));
- }
-
- #ifdef __STDC__
- double frexp(register double x,register int *p)
- #else
- double frexp(x,p)
- register double x;
- register int *p;
- #endif
- {
- register int e = 0;
-
- if (x != 0)
- {
- while (x < 0.5) { x *= 2; e--; }
- while (x >= 1) { x /= 2; e++; }
- }
-
- *p = e; return(x);
- }
-
- #ifdef __STDC__
- double ldexp(register double x,register int y)
- #else
- double ldexp(x,y)
- register double x;
- register int y;
- #endif
- {
- return(x * pow((double)2,(double)y));
- }
-